<{Tinclude "commom/admin_header"}>
  <section id="container" >
      
      <!--顶部-->
      <{Tinclude"commom/admin_inner_header"}>
      <!--顶部-->
      
       <{Tinclude"commom/admin_left_menu"}>
      
      <!-- **********************************************************************************************************************************************************
      MAIN CONTENT
      *********************************************************************************************************************************************************** -->
      <!--main content start-->
      <section id="main-content">
          <section class="wrapper">

              <div class="row">
                  <div class="col-lg-9 main-chart">
                  
                  	<div class="row mtbox">
                  		<div class="col-md-2 col-sm-2 col-md-offset-1 box0">
                  			<div class="box1">
					  			<span class="fa fa-user"></span>
					  			<h3>+<{$zucount}></h3>
                  			</div>
					  			<p>本月新租户<{$zucount}>个</p>
                  		</div>
                  		<div class="col-md-2 col-sm-2 box0">
                  			<div class="box1">
					  			<span class="fa fa-money"></span>
					  			<h3>+<{$total}></h3>
                  			</div>
					  			<p>本月实收租金<{$total}>元</p>
                  		</div>
                            <{if $qianzuzuiduo}>
                  		<div class="col-md-2 col-sm-2 box0">
                  			<div class="box1">
					  			<span class="fa fa-warning"></span>
					  			<h3>-<{$qianzuzuiduo["qianjin"]}></h3>
                  			</div>
                                    <p class="breakall"><{$qianzuzuiduo["local"]}>-<{$qianzuzuiduo["layer_id"]}>楼-<{$qianzuzuiduo["room_no"]}>(<{$qianzuzuiduo["user_name"]}>)所欠租金<{$qianzuzuiduo["qianjin"]}>元</p>
                  		</div>
                            <{else}>
                            <div class="col-md-2 col-sm-2 box0">
                  			<div class="box1">
					  			<span class="fa fa-warning"></span>
					  			<h3>0</h3>
                  			</div>
					  			<p>交租情况良好,无人欠租</p>
                  		</div>
                            <{/if}>
                  		<div class="col-md-2 col-sm-2 box0">
                  			<div class="box1">
					  			<span class="fa fa-tumblr-square"></span>
					  			<h3>-<{$tuicount}></h3>
                  			</div>
					  			<p>这个月搬走<{$tuicount}>个用户</p>
                  		</div>
                            <{if $zuijinjiaozuren}>
                  		<div class="col-md-2 col-sm-2 box0">
                  			<div class="box1">
					  			<span class="fa fa-bell"></span>
                                                                <h3 class="overflowhide"><{$zuijinjiaozuren["user_name"]}></h3>
                  			</div>
					  			<p>(待交租)<{$zuijinjiaozuren["local"]}>-<{$zuijinjiaozuren["layer_id"]}>楼-<{$zuijinjiaozuren["room_no"]}>,到期时间<{echo date("Y-m-d",$zuijinjiaozuren["effective_time"]);}></p>
                  		</div>
                            <{else}>
                            <div class="col-md-2 col-sm-2 box0">
                  			<div class="box1">
					  			<span class="fa fa-bell"></span>
					  			<h3>无</h3>
                  			</div>
					  			<p>(待交租)最近无待交租</p>
                  		</div>
                            <{/if}>
                  	
                  	</div><!-- /row mt -->	
                  
                      
                      <div class="row mt">
                      <!-- SERVER STATUS PANELS -->
                      
                     <{if $newuser}> 
                      <div class="col-md-4 mb">
							<!-- WHITE PANEL - TOP USER -->
							<div class="white-panel pn">
								<div class="white-header">
									<h5>新用户</h5>
								</div>
                                                            <p><img src="<{$newuser["thumb"]}>" class="img-circle" width="80"></p>
								<p><b><{$newuser["base_name"]}></b></p>
								<div class="row">
									<div class="col-md-6">
                                                                            <p class="small mt"><{$newuser["province"]}>&nbsp;<{$newuser["city"]}></p>
										<p><{echo date("Y-m-d",$zuijinjiaozuren["effective_time"]);}></p>
									</div>
									<div class="col-md-6">
										<p class="small mt"><{if !empty($newuser["third_uid"])}>第三方登录<{else}>注册用户<{/if}></p>
										<p>性别:<{if $newuser["sex"]==1}>男<{else}>女<{/if}></p>
									</div>
								</div>
                                                                <div class="margin_top20">&nbsp;</div>
							</div>
						</div><!-- /col-md-4 -->
                                                <{else}>
                                                 <div class="col-md-4 mb">
							<!-- WHITE PANEL - TOP USER -->
							<div class="white-panel pn">
								<div class="white-header">
									<h5>欠租最多的租户</h5>
								</div>
                                                            <p><img src="<{$qianzuzuiduo["userinfo"]["thumb"]}>" class="img-circle" width="80"></p>
								<p><b><{$qianzuzuiduo["user_name"]}></b></p>
								<div class="row">
									<div class="col-md-6">
                                                                            <p class="small mt"><{$qianzuzuiduo["local"]}></p>
										<p><{$qianzuzuiduo["userinfo"]["province"]}>&nbsp;<{$qianzuzuiduo["userinfo"]["city"]}></p>
									</div>
									<div class="col-md-6">
										<p class="small mt"><{$qianzuzuiduo["layer_id"]}>楼-<{$qianzuzuiduo["room_no"]}>号</p>
										<p>欠:<{$qianzuzuiduo["qianjin"]}>元</p>
									</div>
								</div>
                                                                <div class="margin_top20">入住时间:<{echo date("Y年m月d日",$qianzuzuiduo["roomreluser"]["create_time"]);}></div>
							</div>
						</div><!-- /col-md-4 -->
                      <{/if}>
                       <{if isset($newusercount)&&isset($usercount)}> 
                      	<div class="col-md-4 col-sm-4 mb">
                      		<div class="white-panel pn donut-chart">
                      			<div class="white-header">
						  			<h5>今日新注册用户</h5>
                      			</div>
								<div class="row">
									<div class="col-sm-6 col-xs-6 goleft">
										<p><i class="fa fa-user"></i> <{$newusercount}>人</p>
									</div>
                                                                   
	                      		</div>
                                   
                                    <div id="serverstatus01" style="width: 140px;height: 140px;margin: 0 auto;"></div>
								<script>
                                                                    $(document).ready(function(){
                                                                        Morris.Donut({
                                                                            element: 'serverstatus01',
                                                                            data: [
                                                                              {label: '新用户', value: <{$newusercount}> },
                                                                              {label: '总用户', value: <{$usercount}> }    
                                                                            ],
                                                                              colors: ['#3498db', '#2980b9'],
                                                                            formatter: function (y) { return y + "人" }
                                                                          });
                                                                    });
                                                                        
									</script>
                                                                          <div class="margin_top20">&nbsp;</div>
	                      	</div><! --/grey-panel -->
                      	</div><!-- /col-md-4-->
                        <{else}>
                        
                        
                        <div class="col-md-4 col-sm-4 mb">
                      		<div class="white-panel pn donut-chart">
                      			<div class="white-header">
						  			<h5>本月需交租人数</h5>
                      			</div>
								<div class="row">
									<div class="col-sm-6 col-xs-6 goleft">
										<p><i class="fa fa-user"></i> <{$CountJiaoZuRen}>人</p>
									</div>
                                                                   
	                      		</div>
                                   
                                    <div id="serverstatus01" style="width: 140px;height: 140px;margin: 0 auto;"></div>
								<script>
                                                                    $(document).ready(function(){
                                                                        Morris.Donut({
                                                                            element: 'serverstatus01',
                                                                            data: [
                                                                              {label: '未交租', value: <{$CountJiaoZuRen}> },
                                                                              {label: '总人数', value: <{$CountZongJiaoZuRen}> }    
                                                                            ],
                                                                              colors: ['#3498db', '#2980b9'],
                                                                            formatter: function (y) { return y + "人" }
                                                                          });
                                                                    });
                                                                        
									</script>
                                                                          <div class="margin_top20">&nbsp;</div>
	                      	</div><! --/grey-panel -->
                      	</div><!-- /col-md-4-->
                        
                        
                      	 <{/if}>
<{if isset($total)&&isset($ltotal)}> 
                      	<div class="col-md-4 col-sm-4 mb">
                      		<div class="white-panel pn">
                      			<div class="white-header">
						  			<h5>本月需收租金总额</h5>
                      			</div>
								<div class="row">
									<div class="col-sm-6 col-xs-6 goleft">
										<p><i class="fa fa-cny"></i> <{$ltotal}></p>
									</div>
									<div class="col-sm-6 col-xs-6"></div>
	                      		</div>
	                      		<div id="zzjchar" style="width: 140px;height: 140px;margin: 0 auto;"></div>
                                         <div class="margin_top20">&nbsp;</div>
                      		</div>
                      	</div><!-- /col-md-4 -->
                      	<script>
                                                                    $(document).ready(function(){
                                                                        Morris.Donut({
                                                                            element: 'zzjchar',
                                                                            data: [
                                                                              {label: '需支付总金额', value: <{$ltotal}> },
                                                                              {label: '实际支付金额', value: <{$total}>}    
                                                                            ],
                                                                              colors: ['#3498db', '#ff865c'],
                                                                            formatter: function (y) { return y + "元" }
                                                                          });
                                                                    });
                                                                        
									</script>
			<{/if}>			
                      	

                    </div><!-- /row -->
                    
                    				
					<div class="row">
						<!-- TWITTER PANEL -->
						<div class="col-md-4 mb">
                      		<div class="darkblue-panel pn">
                      			<div class="darkblue-header">
						  			<h5>DROPBOX STATICS</h5>
                      			</div>
								<canvas id="serverstatus02" height="120" width="120"></canvas>
								<script>
									var doughnutData = [
											{
												value: 60,
												color:"#68dff0"
											},
											{
												value : 40,
												color : "#444c57"
											}
										];
										var myDoughnut = new Chart(document.getElementById("serverstatus02").getContext("2d")).Doughnut(doughnutData);
								</script>
								<p>April 17, 2014</p>
								<footer>
									<div class="pull-left">
										<h5><i class="fa fa-hdd-o"></i> 17 GB</h5>
									</div>
									<div class="pull-right">
										<h5>60% Used</h5>
									</div>
								</footer>
                      		</div><! -- /darkblue panel -->
						</div><!-- /col-md-4 -->
						
						
						<div class="col-md-4 mb">
							<!-- INSTAGRAM PANEL -->
							<div class="instagram-panel pn">
								<i class="fa fa-instagram fa-4x"></i>
								<p>@THISISYOU<br/>
									5 min. ago
								</p>
								<p><i class="fa fa-comment"></i> 18 | <i class="fa fa-heart"></i> 49</p>
							</div>
						</div><!-- /col-md-4 -->
						
						<div class="col-md-4 col-sm-4 mb">
							<!-- REVENUE PANEL -->
							<div class="darkblue-panel pn">
								<div class="darkblue-header">
									<h5>REVENUE</h5>
								</div>
								<div class="chart mt">
									<div class="sparkline" data-type="line" data-resize="true" data-height="75" data-width="90%" data-line-width="1" data-line-color="#fff" data-spot-color="#fff" data-fill-color="" data-highlight-line-color="#fff" data-spot-radius="4" data-data="[200,135,667,333,526,996,564,123,890,464,655]"></div>
								</div>
								<p class="mt"><b>$ 17,980</b><br/>Month Income</p>
							</div>
						</div><!-- /col-md-4 -->
						
					</div><!-- /row -->
					
					<div class="row mt">
                      <!--CUSTOM CHART START -->
                      <div class="border-head">
                          <h3>VISITS</h3>
                      </div>
                      <div class="custom-bar-chart">
                          <ul class="y-axis">
                              <li><span>10.000</span></li>
                              <li><span>8.000</span></li>
                              <li><span>6.000</span></li>
                              <li><span>4.000</span></li>
                              <li><span>2.000</span></li>
                              <li><span>0</span></li>
                          </ul>
                          <div class="bar">
                              <div class="title">JAN</div>
                              <div class="value tooltips" data-original-title="8.500" data-toggle="tooltip" data-placement="top">85%</div>
                          </div>
                          <div class="bar ">
                              <div class="title">FEB</div>
                              <div class="value tooltips" data-original-title="5.000" data-toggle="tooltip" data-placement="top">50%</div>
                          </div>
                          <div class="bar ">
                              <div class="title">MAR</div>
                              <div class="value tooltips" data-original-title="6.000" data-toggle="tooltip" data-placement="top">60%</div>
                          </div>
                          <div class="bar ">
                              <div class="title">APR</div>
                              <div class="value tooltips" data-original-title="4.500" data-toggle="tooltip" data-placement="top">45%</div>
                          </div>
                          <div class="bar">
                              <div class="title">MAY</div>
                              <div class="value tooltips" data-original-title="3.200" data-toggle="tooltip" data-placement="top">32%</div>
                          </div>
                          <div class="bar ">
                              <div class="title">JUN</div>
                              <div class="value tooltips" data-original-title="6.200" data-toggle="tooltip" data-placement="top">62%</div>
                          </div>
                          <div class="bar">
                              <div class="title">JUL</div>
                              <div class="value tooltips" data-original-title="7.500" data-toggle="tooltip" data-placement="top">75%</div>
                          </div>
                      </div>
                      <!--custom chart end-->
					</div><!-- /row -->	
					
                  </div><!-- /col-lg-9 END SECTION MIDDLE -->
                  
                  
      <!-- **********************************************************************************************************************************************************
      RIGHT SIDEBAR CONTENT
      *********************************************************************************************************************************************************** -->                  
                  
                  <div class="col-lg-3 ds">
                    <{if isset($recvlist)&&$recvlist}>
						<h3>收件箱</h3>
                                                <div class="recvlist">         
                   <{foreach $recvlist as $v}>
                   <a data-toggle="modal" data-id="<{$v["id"]}>" data-type="showonly" data-target="#ajaxshowmessage">
                     <div class="desc">
                      	<div class="thumb">
                            <img class="img-circle" src="<{$v["thumb"]}>" width="35px" height="35px" align="">
                      	</div>
                      	<div class="details">
                      		<p><span class="span"><{$v["from_base_name"]}></span><br/>
                      		   <muted><{$v["title"]}></muted>
                      		</p>
                      	</div>
                      </div>
                  </a>
           <{/foreach}>
         
                                                </div>
                                                  <div class="pager recvpager">
               <button data-pageid="1" data-type="pre" class="btn btn-default btn-sm">上一页</button>&nbsp;&nbsp;<button data-pageid="1" class="btn btn-default btn-sm" data-type="next">下一页</button></div>
                                                <script>
                                                    $(document).ready(function(){
                                                        var curpage=1;
                                                        var pagecount=Math.ceil(<{$recvlistcount}>/5);
                                                        $(".recvpager button").click(function(){
                                                            var pageid=$(this).data("pageid");
                                                            
                                                            var type=$(this).data("type");
                                                            if(type=="pre"){
                                                                if(curpage-1<=0){
                                                                    curpage=1;
                                                                }else{
                                                                    curpage=curpage-1;
                                                                }
                                                                
                                                            }else if(type=="next"){
                                                                if(curpage+1>pagecount){
                                                           
                                                                    curpage=pagecount;
                                                                }else{
                                                                    curpage=curpage+1;
                                                                }
                                                               
                                                            }
                                                           var url="<{echo Common::RewriteUrl("Admin","public_ajax_pagerecvlist");}>";
                                                           $.post(url,{"pageid":curpage},function(data){
                                                               $(".recvlist").html(data);
                                                           });
                                                            
                                                        });
                                                    });
                                                </script>
           <{Tinclude "commom/ajax_show_message"}> 
<{/if}>
                       <!-- USERS ONLINE SECTION -->
                       <h3 class="cursor" data-toggle="modal" data-uid="0" data-uname="房东" data-target="#sendmessage">发件箱&nbsp;&nbsp;&nbsp;&nbsp;<span class="fa fa-envelope"></span></h3>
                      <div class="sendlist">         
                   <{foreach $sendlist as $v}>
                   <a data-toggle="modal" data-id="<{$v["id"]}>" data-type="showonly" data-target="#ajaxshowmessage">
                     <div class="desc">
                      	<div class="thumb">
                            <img class="img-circle" src="<{$v["thumb"]}>" width="35px" height="35px" align="">
                      	</div>
                      	<div class="details">
                      		<p><span class="span"><{$v["to_base_name"]}></span><br/>
                      		   <muted><{$v["title"]}></muted>
                      		</p>
                      	</div>
                      </div>
                  </a>
           <{/foreach}>
         
                                                </div>
                                                
                                                <div class="sendpager pager">
               <button data-pageid="1" data-type="pre" class="btn btn-default btn-sm">上一页</button>&nbsp;&nbsp;<button data-pageid="1" class="btn btn-default btn-sm" data-type="next">下一页</button></div>
<script>
                                                    $(document).ready(function(){
                                                        var sendcurpage=1;
                                                        var sendpagecount=Math.ceil(<{$sendlistcount}>/5);
                                                        $(".sendpager button").click(function(){
                                                            var pageid=$(this).data("pageid");
                                                            
                                                            var type=$(this).data("type");
                                                            if(type=="pre"){
                                                                if(sendcurpage-1<=0){
                                                                    sendcurpage=1;
                                                                }else{
                                                                    sendcurpage=sendcurpage-1;
                                                                }
                                                                
                                                            }else if(type=="next"){
                                                                if(sendcurpage+1>sendpagecount){
                                                           
                                                                    sendcurpage=sendpagecount;
                                                                }else{
                                                                    sendcurpage=curpage+1;
                                                                }
                                                               
                                                            }
                                                           var url="<{echo Common::RewriteUrl("Admin","public_ajax_pagesendlist");}>";
                                                           $.post(url,{"pageid":sendcurpage},function(data){
                                                               $(".sendlist").html(data);
                                                           });
                                                            
                                                        });
                                                    });
                                                </script>
                                                <{Tinclude "commom/ajax_send_message"}>
                        <!-- CALENDAR-->
                        <div id="calendar" class="mb">
                            <div class="panel green-panel no-margin">
                                <div class="panel-body">
                                    <div id="date-popover" class="popover top" style="cursor: pointer; disadding: block; margin-left: 33%; margin-top: -50px; width: 175px;">
                                        <div class="arrow"></div>
                                        <h3 class="popover-title" style="disadding: none;"></h3>
                                        <div id="date-popover-content" class="popover-content"></div>
                                    </div>
                                    <div id="my-calendar"></div>
                                </div>
                            </div>
                        </div><!-- / calendar -->
                      
                  </div><!-- /col-lg-3 -->
              </div><! --/row -->
          </section>
      </section>

      <!--main content end-->
      <!--footer start-->
      <footer class="site-footer">
          <div class="text-center">
              2014 - Alvarez.is
              <a href="index.html#" class="go-top">
                  <i class="fa fa-angle-up"></i>
              </a>
          </div>
      </footer>
      <!--footer end-->
  </section>

   
	<!--
	<script type="text/javascript">
        $(document).ready(function () {
        var unique_id = $.gritter.add({
            // (string | mandatory) the heading of the notification
            title: 'Welcome to Dashgum!',
            // (string | mandatory) the text inside the notification
            text: 'Hover me to enable the Close Button. You can hide the left sidebar clicking on the button next to the logo. Free version for <a href="http://blacktie.co" target="_blank" style="color:#ffd777">BlackTie.co</a>.',
            // (string | optional) the image to display on the left
            image: 'assets/img/ui-sam.jpg',
            // (bool | optional) if you want it to fade out on its own or just sit there
            sticky: true,
            // (int | optional) the time you want it to be alive for before fading out
            time: '',
            // (string | optional) the class name you want to apply to that specific message
            class_name: 'my-sticky-class'
        });

        return false;
        });
	</script>
	-->
	<script type="application/javascript">
        $(document).ready(function () {
            $("#date-popover").popover({html: true, trigger: "manual"});
            $("#date-popover").hide();
            $("#date-popover").click(function (e) {
                $(this).hide();
            });
        
            $("#my-calendar").zabuto_calendar({
                action: function () {
                    return myDateFunction(this.id, false);
                },
                action_nav: function () {
                    return myNavFunction(this.id);
                },
                ajax: {
                    url: "show_data.php?action=1",
                    modal: true
                },
                legend: [
                    {type: "text", label: "Special event", badge: "00"},
                    {type: "block", label: "Regular event", }
                ]
            });
        });
        
        
        function myNavFunction(id) {
            $("#date-popover").hide();
            var nav = $("#" + id).data("navigation");
            var to = $("#" + id).data("to");
            console.log('nav ' + nav + ' to: ' + to.month + '/' + to.year);
        }
    </script>
  

<{Tinclude"commom/admin_footer"}>